﻿using Opc.Ua;
using SD.OpcServer.Host.Hosts;
using System.Collections.Generic;

namespace SD.OpcServer.Host.Variables
{
    /// <summary>
    /// OPC变量组
    /// </summary>
    public class OpcVariableGroup : FolderState
    {
        /// <summary>
        /// 创建OPC变量组构造器
        /// </summary>
        /// <param name="groupName">组名称</param>
        /// <param name="description">描述</param>
        public OpcVariableGroup(string groupName, string description)
            : base(null)
        {
            base.SymbolicName = groupName;
            base.ReferenceTypeId = ReferenceTypes.Organizes;
            base.TypeDefinitionId = ObjectTypeIds.FolderType;
            base.Description = description;
            base.NodeId = new NodeId(groupName);
            base.BrowseName = new QualifiedName(groupName);
            base.DisplayName = new LocalizedText(groupName);
            base.WriteMask = AttributeWriteMask.None;
            base.UserWriteMask = AttributeWriteMask.None;
            base.EventNotifier = EventNotifiers.None;
        }

        /// <summary>
        /// 节点管理器
        /// </summary>
        public NodeManager NodeManager { get; set; }

        /// <summary>
        /// 代理变量列表
        /// </summary>
        public ICollection<OpcVariable> Variables { get; set; }
    }
}